import { Component } from '@angular/core';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import { AuthService } from '../auth.service';
import { Router } from '@angular/router';

@Component({
  selector: 'app-login',
  templateUrl: './login.component.html',
  styleUrls: ['./login.component.css']
})

export class LoginComponent {

  constructor(private authService:AuthService, private router:Router){}

  myform:any = new FormGroup(
    {
      email:new FormControl('', [Validators.required]),
      passwd:new FormControl('', [Validators.required])
    }
  )

  belepes(email:any, passwd:any):void{

    if(this.myform.valid == true)
    {
      this.authService.loginFn(email, passwd);
    }
    else
    {
        window.alert("Minden mező kitöltése kötelező.");
    }
  }

}
